﻿using Mes.Domain.BoundedContext.Entities.Quality;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mes.Infrastructure.Data.BoundedContext.EntityTypeConfigurations.Quality
{
    public class QmSpecRuleLinkEntityConfig : IEntityTypeConfiguration<QmSpecRuleLink>
    {
        public void Configure(EntityTypeBuilder<QmSpecRuleLink> builder)
        {
            builder.ToTable("qm_spec_rule_link");
            builder.HasKey(b => new { b.Qm_Spec_Id,b.Rule_Id});
            builder.Property(b => b.Qm_Spec_Id).IsRequired();
            builder.Property(b => b.Rule_Id).IsRequired();
            builder.Property(b => b.Last_Edit_Comment).HasMaxLength(254);
            builder.Property(b => b.Last_Edit_By).HasMaxLength(40).IsRequired();
            builder.Property(b => b.Last_Edit_At).IsRequired();
            builder.Property(b => b.Row_Id).IsRequired().UseIdentityColumn().HasIdentityOptions(startValue: 0, incrementBy: 1, minValue: 0);
        }
    }
}
